package CodeThree;

import java.util.Scanner;
/** @author ASUS */
public class Reconversion {
  public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    while (input.hasNext()) {
      String tmp = input.nextLine();
      // 进制转换 Integer.parseInt(original_value: string, radix: int)
      System.out.println(Integer.parseInt(tmp.substring(2), 16));
    }
  }
}
